package cn.ztr.ymcc.feign.impl;

import cn.ztr.ymcc.domain.Login;
import cn.ztr.ymcc.domain.Role;
import cn.ztr.ymcc.feign.UaaFeign;
import cn.ztr.ymcc.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Component
public class UaaFeignImpl implements FallbackFactory<UaaFeign> {
    @Override
    public UaaFeign create(Throwable throwable) {
        return new UaaFeign() {
            @Override
            public JsonResult saveOrUpdate(Role role) {
                return JsonResult.error("角色添加失败"+throwable.getMessage());
            }

            @Override
            public JsonResult saveOrUpdate(Login login) {
                return JsonResult.error("登录信息添加失败"+throwable.getMessage());
            }
        };
    }
}
